<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QIcon Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QIcon Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QIcon class provides scalable icons in different modes and
states. <a href="#details">More...</a></p>

<h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qicon.html#Mode-enum">Mode</a></b> { Normal, Disabled, Active, Selected }</li><li><div class="fn" />enum <b><a href="qicon.html#State-enum">State</a></b> { On, Off }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qicon.html#QIcon">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qicon.html#QIcon-2">__init__</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>)</li><li><div class="fn" /><b><a href="qicon.html#QIcon-3">__init__</a></b> (<i>self</i>, QIcon&#160;<i>other</i>)</li><li><div class="fn" /><b><a href="qicon.html#QIcon-4">__init__</a></b> (<i>self</i>, QString&#160;<i>fileName</i>)</li><li><div class="fn" /><b><a href="qicon.html#QIcon-5">__init__</a></b> (<i>self</i>, QIconEngine&#160;<i>engine</i>)</li><li><div class="fn" /><b><a href="qicon.html#QIcon-6">__init__</a></b> (<i>self</i>, QIconEngineV2&#160;<i>engine</i>)</li><li><div class="fn" /><b><a href="qicon.html#QIcon-7">__init__</a></b> (<i>self</i>, QVariant&#160;<i>variant</i>)</li><li><div class="fn" />QSize <b><a href="qicon.html#actualSize">actualSize</a></b> (<i>self</i>, QSize&#160;<i>size</i>, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" /><b><a href="qicon.html#addFile">addFile</a></b> (<i>self</i>, QString&#160;<i>fileName</i>, QSize&#160;<i>size</i>&#160;=&#160;QSize(), Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" /><b><a href="qicon.html#addPixmap">addPixmap</a></b> (<i>self</i>, QPixmap&#160;<i>pixmap</i>, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" />list-of-QSize <b><a href="qicon.html#availableSizes">availableSizes</a></b> (<i>self</i>, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" />int <b><a href="qicon.html#cacheKey">cacheKey</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qicon.html#isDetached">isDetached</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qicon.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qicon.html#name">name</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qicon.html#paint">paint</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, QRect&#160;<i>rect</i>, Qt.Alignment&#160;<i>alignment</i>&#160;=&#160;Qt.AlignCenter, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" /><b><a href="qicon.html#paint-2">paint</a></b> (<i>self</i>, QPainter&#160;<i>painter</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, Qt.Alignment&#160;<i>alignment</i>&#160;=&#160;Qt.AlignCenter, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" />QPixmap <b><a href="qicon.html#pixmap">pixmap</a></b> (<i>self</i>, QSize&#160;<i>size</i>, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" />QPixmap <b><a href="qicon.html#pixmap-2">pixmap</a></b> (<i>self</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" />QPixmap <b><a href="qicon.html#pixmap-3">pixmap</a></b> (<i>self</i>, int&#160;<i>extent</i>, Mode&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, State&#160;<i>state</i>&#160;=&#160;QIcon.Off)</li><li><div class="fn" />int <b><a href="qicon.html#serialNumber">serialNumber</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QIcon <b><a href="qicon.html#fromTheme">fromTheme</a></b> (QString&#160;<i>name</i>, QIcon&#160;<i>fallback</i>&#160;=&#160;QIcon())</li><li><div class="fn" />bool <b><a href="qicon.html#hasThemeIcon">hasThemeIcon</a></b> (QString&#160;<i>name</i>)</li><li><div class="fn" /><b><a href="qicon.html#setThemeName">setThemeName</a></b> (QString&#160;<i>path</i>)</li><li><div class="fn" /><b><a href="qicon.html#setThemeSearchPaths">setThemeSearchPaths</a></b> (QStringList&#160;<i>searchpath</i>)</li><li><div class="fn" />QString <b><a href="qicon.html#themeName">themeName</a></b> ()</li><li><div class="fn" />QStringList <b><a href="qicon.html#themeSearchPaths">themeSearchPaths</a></b> ()</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QIcon class provides scalable icons in different modes and
states.</p>
<p>A QIcon can generate smaller, larger, active, and disabled
pixmaps from the set of pixmaps it is given. Such pixmaps are used
by Qt widgets to show an icon representing a particular action.</p>
<p>The simplest use of QIcon is to create one from a <a href="qpixmap.html">QPixmap</a> file or resource, and then use it,
allowing Qt to work out all the required icon styles and sizes. For
example:</p>
<pre class="cpp">
 <span class="type"><a href="qtoolbutton.html">QToolButton</a></span> <span class="operator">*</span>button <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qtoolbutton.html">QToolButton</a></span>;
 button<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="type">QIcon</span>(<span class="string">"open.xpm"</span>));
</pre>
<p>To undo a QIcon, simply set a null icon in its place:</p>
<pre class="cpp">
 button<span class="operator">-</span><span class="operator">&gt;</span>setIcon(<span class="type">QIcon</span>());
</pre>
<p>Use the <a href="qimagereader.html#supportedImageFormats">QImageReader.supportedImageFormats</a>()
and <a href="qimagewriter.html#supportedImageFormats">QImageWriter.supportedImageFormats</a>()
functions to retrieve a complete list of the supported file
formats.</p>
<p>When you retrieve a pixmap using pixmap(<a href="qsize.html">QSize</a>, Mode, State), and no pixmap for this given
size, mode and state has been added with <a href="qicon.html#addFile">addFile</a>() or <a href="qicon.html#addPixmap">addPixmap</a>(), then QIcon will generate
one on the fly. This pixmap generation happens in a <a href="qiconenginev2.html">QIconEngineV2</a>. The default engine scales
pixmaps down if required, but never up, and it uses the current
style to calculate a disabled appearance. By using custom icon
engines, you can customize every aspect of generated icons. With
<a href="qiconenginepluginv2.html">QIconEnginePluginV2</a> it is
possible to register different icon engines for different file
suffixes, making it possible for third parties to provide
additional icon engines to those included with Qt.</p>
<p><b>Note:</b> Since Qt 4.2, an icon engine that supports SVG is
included.</p>
<a id="making-classes-that-use-qicon" name="making-classes-that-use-qicon" />
<h3>Making Classes that Use QIcon</h3>
<p>If you write your own widgets that have an option to set a small
pixmap, consider allowing a QIcon to be set for that pixmap. The Qt
class <a href="qtoolbutton.html">QToolButton</a> is an example of
such a widget.</p>
<p>Provide a method to set a QIcon, and when you draw the icon,
choose whichever pixmap is appropriate for the current state of
your widget. For example:</p>
<pre class="cpp">
 <span class="type">void</span> MyWidget<span class="operator">.</span>drawIcon(<span class="type"><a href="qpainter.html">QPainter</a></span> <span class="operator">*</span>painter<span class="operator">,</span> <span class="type"><a href="qpoint.html">QPoint</a></span> pos)
 {
     <span class="type"><a href="qpixmap.html">QPixmap</a></span> pixmap <span class="operator">=</span> icon<span class="operator">.</span>pixmap(<span class="type"><a href="qsize.html">QSize</a></span>(<span class="number">22</span><span class="operator">,</span> <span class="number">22</span>)<span class="operator">,</span>
                                    isEnabled() <span class="operator">?</span> <span class="type">QIcon</span><span class="operator">.</span>Normal
                                                : <span class="type">QIcon</span><span class="operator">.</span>Disabled<span class="operator">,</span>
                                    isChecked() <span class="operator">?</span> <span class="type">QIcon</span><span class="operator">.</span>On
                                                : <span class="type">QIcon</span><span class="operator">.</span>Off);
     painter<span class="operator">-</span><span class="operator">&gt;</span>drawPixmap(pos<span class="operator">,</span> pixmap);
 }
</pre>
<p>You might also make use of the <tt>Active</tt> mode, perhaps
making your widget <tt>Active</tt> when the mouse is over the
widget (see <a href="qwidget.html#enterEvent">QWidget.enterEvent</a>()), while the
mouse is pressed pending the release that will activate the
function, or when it is the currently selected item. If the widget
can be toggled, the "On" mode might be used to draw a different
icon.</p>
<p class="centerAlign"><img alt="QIcon" src="images/icon.png" /></p>
<hr /><h2>Type Documentation</h2><h3 class="fn"><a name="Mode-enum" />QIcon.Mode</h3><p>This enum type describes the mode for which a pixmap is intended
to be used. The currently defined modes are:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QIcon.Normal</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Display the pixmap when the user is not
interacting with the icon, but the functionality represented by the
icon is available.</td>
</tr>
<tr>
<td class="topAlign"><tt>QIcon.Disabled</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Display the pixmap when the functionality
represented by the icon is not available.</td>
</tr>
<tr>
<td class="topAlign"><tt>QIcon.Active</tt></td>
<td class="topAlign"><tt>2</tt></td>
<td class="topAlign">Display the pixmap when the functionality
represented by the icon is available and the user is interacting
with the icon, for example, moving the mouse over it or clicking
it.</td>
</tr>
<tr>
<td class="topAlign"><tt>QIcon.Selected</tt></td>
<td class="topAlign"><tt>3</tt></td>
<td class="topAlign">Display the pixmap when the item represented
by the icon is selected.</td>
</tr>
</table>


<h3 class="fn"><a name="State-enum" />QIcon.State</h3><p>This enum describes the state for which a pixmap is intended to
be used. The <i>state</i> can be:</p>
<table class="valuelist">
<tr class="odd" valign="top">
<th class="tblConst">Constant</th>
<th class="tblval">Value</th>
<th class="tbldscr">Description</th>
</tr>
<tr>
<td class="topAlign"><tt>QIcon.Off</tt></td>
<td class="topAlign"><tt>1</tt></td>
<td class="topAlign">Display the pixmap when the widget is in an
"off" state</td>
</tr>
<tr>
<td class="topAlign"><tt>QIcon.On</tt></td>
<td class="topAlign"><tt>0</tt></td>
<td class="topAlign">Display the pixmap when the widget is in an
"on" state</td>
</tr>
</table>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QIcon" />QIcon.__init__ (<i>self</i>)</h3><p>Constructs a null icon.</p>


<h3 class="fn"><a name="QIcon-2" />QIcon.__init__ (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>)</h3><p>Constructs an icon from a <i>pixmap</i>.</p>


<h3 class="fn"><a name="QIcon-3" />QIcon.__init__ (<i>self</i>, <a href="qicon.html">QIcon</a>&#160;<i>other</i>)</h3><p>Constructs a copy of <i>other</i>. This is very fast.</p>


<h3 class="fn"><a name="QIcon-4" />QIcon.__init__ (<i>self</i>, QString&#160;<i>fileName</i>)</h3><p>Constructs an icon from the file with the given <i>fileName</i>.
The file will be loaded on demand.</p>
<p>If <i>fileName</i> contains a relative path (e.g. the filename
only) the relevant file must be found relative to the runtime
working directory.</p>
<p>The file name can be either refer to an actual file on disk or
to one of the application's embedded resources. See the <a href="resources.html">Resource System</a> overview for details on how to
embed images and other resource files in the application's
executable.</p>
<p>Use the <a href="qimagereader.html#supportedImageFormats">QImageReader.supportedImageFormats</a>()
and <a href="qimagewriter.html#supportedImageFormats">QImageWriter.supportedImageFormats</a>()
functions to retrieve a complete list of the supported file
formats.</p>


<h3 class="fn"><a name="QIcon-5" />QIcon.__init__ (<i>self</i>, <a href="qiconengine.html">QIconEngine</a>&#160;<i>engine</i>)</h3><p>The <i>engine</i> argument has it's ownership transferred to Qt.</p><p>Creates an icon with a specific icon <i>engine</i>. The icon
takes ownership of the engine.</p>


<h3 class="fn"><a name="QIcon-6" />QIcon.__init__ (<i>self</i>, <a href="qiconenginev2.html">QIconEngineV2</a>&#160;<i>engine</i>)</h3><p>The <i>engine</i> argument has it's ownership transferred to Qt.</p><p>Creates an icon with a specific icon <i>engine</i>. The icon
takes ownership of the engine.</p>


<h3 class="fn"><a name="QIcon-7" />QIcon.__init__ (<i>self</i>, QVariant&#160;<i>variant</i>)</h3><h3 class="fn"><a name="actualSize" /><a href="qsize.html">QSize</a> QIcon.actualSize (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>size</i>, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>Returns the actual size of the icon for the requested
<i>size</i>, <i>mode</i>, and <i>state</i>. The result might be
smaller than requested, but never larger.</p>
<p><b>See also</b> <a href="qicon.html#pixmap">pixmap</a>() and
<a href="qicon.html#paint">paint</a>().</p>


<h3 class="fn"><a name="addFile" />QIcon.addFile (<i>self</i>, QString&#160;<i>fileName</i>, <a href="qsize.html">QSize</a>&#160;<i>size</i>&#160;=&#160;QSize(), <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>Adds an image from the file with the given <i>fileName</i> to
the icon, as a specialization for <i>size</i>, <i>mode</i> and
<i>state</i>. The file will be loaded on demand. Note: custom icon
engines are free to ignore additionally added pixmaps.</p>
<p>If <i>fileName</i> contains a relative path (e.g. the filename
only) the relevant file must be found relative to the runtime
working directory.</p>
<p>The file name can be either refer to an actual file on disk or
to one of the application's embedded resources. See the <a href="resources.html">Resource System</a> overview for details on how to
embed images and other resource files in the application's
executable.</p>
<p>Use the <a href="qimagereader.html#supportedImageFormats">QImageReader.supportedImageFormats</a>()
and <a href="qimagewriter.html#supportedImageFormats">QImageWriter.supportedImageFormats</a>()
functions to retrieve a complete list of the supported file
formats.</p>
<p>Note: When you add a non-empty filename to a <a href="qicon.html">QIcon</a>, the icon becomes non-null, even if the file
doesn't exist or points to a corrupt file.</p>
<p><b>See also</b> <a href="qicon.html#addPixmap">addPixmap</a>().</p>


<h3 class="fn"><a name="addPixmap" />QIcon.addPixmap (<i>self</i>, <a href="qpixmap.html">QPixmap</a>&#160;<i>pixmap</i>, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>Adds <i>pixmap</i> to the icon, as a specialization for
<i>mode</i> and <i>state</i>.</p>
<p>Custom icon engines are free to ignore additionally added
pixmaps.</p>
<p><b>See also</b> <a href="qicon.html#addFile">addFile</a>().</p>


<h3 class="fn"><a name="availableSizes" />list-of-QSize QIcon.availableSizes (<i>self</i>, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>Returns a list of available icon sizes for the specified
<i>mode</i> and <i>state</i>.</p>
<p>This function was introduced in Qt 4.5.</p>


<h3 class="fn"><a name="cacheKey" />int QIcon.cacheKey (<i>self</i>)</h3><p>Returns a number that identifies the contents of this <a href="qicon.html">QIcon</a> object. Distinct <a href="qicon.html">QIcon</a> objects can have the same key if they refer
to the same contents.</p>
<p>The cacheKey() will change when the icon is altered via <a href="qicon.html#addPixmap">addPixmap</a>() or <a href="qicon.html#addFile">addFile</a>().</p>
<p>Cache keys are mostly useful in conjunction with caching.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also</b> <a href="qpixmap.html#cacheKey">QPixmap.cacheKey</a>().</p>


<h3 class="fn"><a name="fromTheme" /><a href="qicon.html">QIcon</a> QIcon.fromTheme (QString&#160;<i>name</i>, <a href="qicon.html">QIcon</a>&#160;<i>fallback</i>&#160;=&#160;QIcon())</h3><p>Returns the <a href="qicon.html">QIcon</a> corresponding to
<i>name</i> in the current icon theme. If no such icon is found in
the current theme <i>fallback</i> is returned instead.</p>
<p>The latest version of the freedesktop icon specification and
naming specification can be obtained here:</p>
<ul>
<li><a href="http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html">
http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html</a></li>
<li><a href="http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html">
http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html</a></li>
</ul>
<p>To fetch an icon from the current icon theme:</p>
<pre class="cpp">
     <span class="type"><a href="qicon.html">QIcon</a></span> undoicon <span class="operator">=</span> <span class="type"><a href="qicon.html">QIcon</a></span><span class="operator">.</span>fromTheme(<span class="string">"edit-undo"</span>);
</pre>
<p>Or if you want to provide a guaranteed fallback for platforms
that do not support theme icons, you can use the second
argument:</p>
<pre class="cpp">
     <span class="type"><a href="qicon.html">QIcon</a></span> undoicon <span class="operator">=</span> <span class="type"><a href="qicon.html">QIcon</a></span><span class="operator">.</span>fromTheme(<span class="string">"edit-undo"</span><span class="operator">,</span> <span class="type"><a href="qicon.html">QIcon</a></span>(<span class="string">":/undo.png"</span>));
</pre>
<p><b>Note:</b> By default, only X11 will support themed icons. In
order to use themed icons on Mac and Windows, you will have to
bundle a compliant theme in one of your <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>() and set the
appropriate <a href="qicon.html#themeName">themeName</a>().</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qicon.html#themeName">themeName</a>(),
<a href="qicon.html#setThemeName">setThemeName</a>(), and <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>().</p>


<h3 class="fn"><a name="hasThemeIcon" />bool QIcon.hasThemeIcon (QString&#160;<i>name</i>)</h3><p>Returns true if there is an icon available for <i>name</i> in
the current icon theme, otherwise returns false.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#setThemeName">setThemeName</a>().</p>


<h3 class="fn"><a name="isDetached" />bool QIcon.isDetached (<i>self</i>)</h3><h3 class="fn"><a name="isNull" />bool QIcon.isNull (<i>self</i>)</h3><p>Returns true if the icon is empty; otherwise returns false.</p>
<p>An icon is empty if it has neither a pixmap nor a filename.</p>
<p>Note: Even a non-null icon might not be able to create valid
pixmaps, eg. if the file does not exist or cannot be read.</p>


<h3 class="fn"><a name="name" />QString QIcon.name (<i>self</i>)</h3><p>Returns the name used to create the icon, if available.</p>
<p>Depending on the way the icon was created, it may have an
associated name. This is the case for icons created with <a href="qicon.html#fromTheme">fromTheme</a>() or icons using a <a href="qiconengine.html">QIconEngine</a> which supports the <a href="qiconenginev2.html#IconEngineHook-enum">QIconEngineV2.IconNameHook</a>.</p>
<p>This function was introduced in Qt 4.7.</p>
<p><b>See also</b> <a href="qicon.html#fromTheme">fromTheme</a>()
and <a href="qiconengine.html">QIconEngine</a>.</p>


<h3 class="fn"><a name="paint" />QIcon.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, <a href="qrect.html">QRect</a>&#160;<i>rect</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>alignment</i>&#160;=&#160;Qt.AlignCenter, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>Uses the <i>painter</i> to paint the icon with specified
<i>alignment</i>, required <i>mode</i>, and <i>state</i> into the
rectangle <i>rect</i>.</p>
<p><b>See also</b> <a href="qicon.html#actualSize">actualSize</a>()
and <a href="qicon.html#pixmap">pixmap</a>().</p>


<h3 class="fn"><a name="paint-2" />QIcon.paint (<i>self</i>, <a href="qpainter.html">QPainter</a>&#160;<i>painter</i>, int&#160;<i>x</i>, int&#160;<i>y</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>alignment</i>&#160;=&#160;Qt.AlignCenter, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>This is an overloaded function.</p>
<p>Paints the icon into the rectangle <a href="qrect.html">QRect</a>(<i>x</i>, <i>y</i>, <i>w</i>, <i>h</i>).</p>


<h3 class="fn"><a name="pixmap" /><a href="qpixmap.html">QPixmap</a> QIcon.pixmap (<i>self</i>, <a href="qsize.html">QSize</a>&#160;<i>size</i>, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><p>Returns a pixmap with the requested <i>size</i>, <i>mode</i>,
and <i>state</i>, generating one if necessary. The pixmap might be
smaller than requested, but never larger.</p>
<p><b>See also</b> <a class="compat" href="qicon-qt3.html#setPixmap">setPixmap</a>(), <a href="qicon.html#actualSize">actualSize</a>(), and <a href="qicon.html#paint">paint</a>().</p>


<h3 class="fn"><a name="pixmap-2" /><a href="qpixmap.html">QPixmap</a> QIcon.pixmap (<i>self</i>, int&#160;<i>w</i>, int&#160;<i>h</i>, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><h3 class="fn"><a name="pixmap-3" /><a href="qpixmap.html">QPixmap</a> QIcon.pixmap (<i>self</i>, int&#160;<i>extent</i>, <a href="qicon.html#Mode-enum">Mode</a>&#160;<i>mode</i>&#160;=&#160;QIcon.Normal, <a href="qicon.html#State-enum">State</a>&#160;<i>state</i>&#160;=&#160;QIcon.Off)</h3><h3 class="fn"><a name="serialNumber" />int QIcon.serialNumber (<i>self</i>)</h3><h3 class="fn"><a name="setThemeName" />QIcon.setThemeName (QString&#160;<i>path</i>)</h3><p>Sets the current icon theme to <i>name</i>.</p>
<p>The <i>name</i> should correspond to a directory name in the
themeSearchPath() containing an index.theme file describing it's
contents.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>() and <a href="qicon.html#themeName">themeName</a>().</p>


<h3 class="fn"><a name="setThemeSearchPaths" />QIcon.setThemeSearchPaths (QStringList&#160;<i>searchpath</i>)</h3><p>Sets the search paths for icon themes to <i>paths</i>.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#setThemeName">setThemeName</a>().</p>


<h3 class="fn"><a name="themeName" />QString QIcon.themeName ()</h3><p>Returns the name of the current icon theme.</p>
<p>On X11, the current icon theme depends on your desktop settings.
On other platforms it is not set by default.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qicon.html#setThemeName">setThemeName</a>(), <a href="qicon.html#themeSearchPaths">themeSearchPaths</a>(), <a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#hasThemeIcon">hasThemeIcon</a>().</p>


<h3 class="fn"><a name="themeSearchPaths" />QStringList QIcon.themeSearchPaths ()</h3><p>Returns the search paths for icon themes.</p>
<p>The default value will depend on the platform:</p>
<p>On X11, the search path will use the XDG_DATA_DIRS environment
variable if available.</p>
<p>By default all platforms will have the resource directory
<tt>:\icons</tt> as a fallback. You can use "rcc -project" to
generate a resource file from your icon theme.</p>
<p>This function was introduced in Qt 4.6.</p>
<p><b>See also</b> <a href="qicon.html#setThemeSearchPaths">setThemeSearchPaths</a>(),
<a href="qicon.html#fromTheme">fromTheme</a>(), and <a href="qicon.html#setThemeName">setThemeName</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>